<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
    <script src="./utils/setCanvas.js"></script>
</head>

<body>
    <div id="map">
    </div>
    <script>
        var map = new ol.Map({
            target: "map",
            layers: [gaode],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        /* 1、设置动画图层 */
        var source = new ol.source.Vector({});
        var layer = new ol.layer.Vector({
            source
        })
        map.addLayer(layer);
        let canvas = setCanvas(map)
        let style = new ol.style.Style({
            image: new ol.style.Icon({
                img: canvas,
                imgSize: [canvas.width, canvas.height]
            })
        })
        var point = new ol.Feature({
            geometry: new ol.geom.Point([114.30, 30.50])
        })
        var beijing = new ol.Feature({
            geometry: new ol.geom.Point([120, 40])
        })
        source.addFeatures([point, beijing]);
        layer.setStyle(style);
    </script>
</body>

</html>